import {VIRTUAL_NODE_TYPE} from "../constant";

export class VNode {

    // 在 vnode 生成阶段，不再添加代码编译提示信息
    // 只提示运行时错误

    /**
     * 创建一个 VNode 对象
     * @param {String} tag 标签名称
     * @param {Object} data 标签 固化数据信息 渲染控制信息
     * @param {Array<VNode>} children  该节点的孩子节点
     * @param {String} textContent 该节点的文本值
     */
    constructor(tag,
                data,
                children,
                textContent) {
        this.tag = tag;
        this.data = data;
        this.children = children ? children : [];
        this.textContent = textContent ? textContent : '';

        this.elem = null;
        this.context = null;

        this.isComponent = false;
        this.componentOptions = null;
        this.componentInstance = null;

        this.parent = null;
        this.nodeType = VIRTUAL_NODE_TYPE.ELEMENT;
        this.isOnce = false;
        this.key = undefined;
    }

}

